﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.53    贷款预收款信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_LOAN_ADVREC: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_LOAN_ADVREC()
		{}
		#region Model
		private long _id;
		private long _proid;
		private long _conid;
		private long _loanid;
		private string _custname;
		private string _custno;
		private string _conno;
		private string _loanno;
		private string _applyno;
		private decimal _amt;
		private decimal _disamt;
		private decimal _backamt;
		private decimal _leftamt;
		private Nullable<DateTime> _paydate;
		private string _accountname;
		private long _accountid;
		private string _exchangeno;
		private string _createby;
		private Nullable<DateTime> _createdate;
		private string _remark;
		private int _status;
		private string _confirmby;
		private Nullable<DateTime> _confirmdate;
		private int _systemid;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 放款记录ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 客户名称
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 证件号码
		/// </summary>
		[DataMember]
		public string CUSTNO
		{
			get{return _custno;}
			set{
				if ( _custno!= value)
				{
					 _custno = value;
					OnPropertyChanged("CUSTNO");
				}
			}
		}
		/// <summary>
		/// 合同编号
		/// </summary>
		[DataMember]
		public string CONNO
		{
			get{return _conno;}
			set{
				if ( _conno!= value)
				{
					 _conno = value;
					OnPropertyChanged("CONNO");
				}
			}
		}
		/// <summary>
		/// 贷款号
		/// </summary>
		[DataMember]
		public string LOANNO
		{
			get{return _loanno;}
			set{
				if ( _loanno!= value)
				{
					 _loanno = value;
					OnPropertyChanged("LOANNO");
				}
			}
		}
		/// <summary>
		/// 申请编号
		/// </summary>
		[DataMember]
		public string APPLYNO
		{
			get{return _applyno;}
			set{
				if ( _applyno!= value)
				{
					 _applyno = value;
					OnPropertyChanged("APPLYNO");
				}
			}
		}
		/// <summary>
		/// 收款金额
		/// </summary>
		[DataMember]
		public decimal AMT
		{
			get{return _amt;}
			set{
				if ( _amt!= value)
				{
					 _amt = value;
					OnPropertyChanged("AMT");
				}
			}
		}
		/// <summary>
		/// 核销金额
		/// </summary>
		[DataMember]
		public decimal DISAMT
		{
			get{return _disamt;}
			set{
				if ( _disamt!= value)
				{
					 _disamt = value;
					OnPropertyChanged("DISAMT");
				}
			}
		}
		/// <summary>
		/// 退款金额
		/// </summary>
		[DataMember]
		public decimal BACKAMT
		{
			get{return _backamt;}
			set{
				if ( _backamt!= value)
				{
					 _backamt = value;
					OnPropertyChanged("BACKAMT");
				}
			}
		}
		/// <summary>
		/// 结余
		/// </summary>
		[DataMember]
		public decimal LEFTAMT
		{
			get{return _leftamt;}
			set{
				if ( _leftamt!= value)
				{
					 _leftamt = value;
					OnPropertyChanged("LEFTAMT");
				}
			}
		}
		/// <summary>
		/// 收款日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> PAYDATE
		{
			get{return _paydate;}
			set{
				if ( _paydate!= value)
				{
					 _paydate = value;
					OnPropertyChanged("PAYDATE");
				}
			}
		}
		/// <summary>
		/// 收款账号
		/// </summary>
		[DataMember]
		public string ACCOUNTNAME
		{
			get{return _accountname;}
			set{
				if ( _accountname!= value)
				{
					 _accountname = value;
					OnPropertyChanged("ACCOUNTNAME");
				}
			}
		}
		/// <summary>
		/// 收款账号记录ID
		/// </summary>
		[DataMember]
		public long ACCOUNTID
		{
			get{return _accountid;}
			set{
				if ( _accountid!= value)
				{
					 _accountid = value;
					OnPropertyChanged("ACCOUNTID");
				}
			}
		}
		/// <summary>
		/// 水单号
		/// </summary>
		[DataMember]
		public string EXCHANGENO
		{
			get{return _exchangeno;}
			set{
				if ( _exchangeno!= value)
				{
					 _exchangeno = value;
					OnPropertyChanged("EXCHANGENO");
				}
			}
		}
		/// <summary>
		/// 录入人
		/// </summary>
		[DataMember]
		public string CREATEBY
		{
			get{return _createby;}
			set{
				if ( _createby!= value)
				{
					 _createby = value;
					OnPropertyChanged("CREATEBY");
				}
			}
		}
		/// <summary>
		/// 录入时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATEDATE
		{
			get{return _createdate;}
			set{
				if ( _createdate!= value)
				{
					 _createdate = value;
					OnPropertyChanged("CREATEDATE");
				}
			}
		}
		/// <summary>
		/// 备注
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 状态0保存，1确认
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 确认人
		/// </summary>
		[DataMember]
		public string CONFIRMBY
		{
			get{return _confirmby;}
			set{
				if ( _confirmby!= value)
				{
					 _confirmby = value;
					OnPropertyChanged("CONFIRMBY");
				}
			}
		}
		/// <summary>
		/// 确认时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CONFIRMDATE
		{
			get{return _confirmdate;}
			set{
				if ( _confirmdate!= value)
				{
					 _confirmdate = value;
					OnPropertyChanged("CONFIRMDATE");
				}
			}
		}
		/// <summary>
		/// 来源
		/// </summary>
		[DataMember]
		public int SYSTEMID
		{
			get{return _systemid;}
			set{
				if ( _systemid!= value)
				{
					 _systemid = value;
					OnPropertyChanged("SYSTEMID");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

